#ifndef AODV_RREP_H
#define AODV_RREP_H

#include "aodv_types.h"
#include "aodv_routing_table.h"

// RREP处理相关的函数声明

// 处理接收到的RREP消息
int process_rrep_message(const aodv_rrep *rrep, uint32_t source_ip, 
                        aodv_routing_table *routing_table, uint32_t local_ip);

// 根据RREP消息更新路由表
int update_route_from_rrep(aodv_routing_table *routing_table, const aodv_rrep *rrep, 
                          uint32_t next_hop, uint32_t local_ip);

// 检查RREP是否有效
int is_valid_rrep(const aodv_rrep *rrep);

// 转发RREP消息（如果需要）
int forward_rrep(const aodv_rrep *rrep, aodv_routing_table *routing_table, 
                 uint32_t local_ip, int socket);

// 处理RREP超时
int handle_rrep_timeout(aodv_routing_table *routing_table, uint32_t dest_addr);

#endif // AODV_RREP_H